#pragma once
#include <iostream>

using namespace std;

enum
{
    ok = 0,
    div_zero,
    mod_zero,
    unknow
};

const string opers="+-*/%#!$";

class Task
{
    int data_x, data_y, result, code;
    char oper;

public:
    Task() {}
    Task(int x, int y, char op)
        : data_x(x), data_y(y), oper(op), result(0)
    {
    }
    ~Task() {}

    string PrintTask()
    {
        string s = to_string(data_x)+oper+to_string(data_y)+"=?";
        return s;
    }

    string PrintResult()
    {
        string s = to_string(data_x)+oper+to_string(data_y)+"="+to_string(result) +"  ["+to_string(code)+']';
        return s;
    }

    void operator()()
    {
        Run();
    }
    void Run()
    {
        switch (oper)
        {
        case '+':
            result = data_x + data_y;
            break;
        case '-':
            result = data_x - data_y;
            break;
        case '*':
            result = data_x * data_y;
            break;
        case '/':
            if (data_y == 0)
                code = div_zero;
            else
                result = data_x / data_y;
            break;
        case '%':
            if (data_y == 0)
                code = mod_zero;
            else
                result = data_x % data_y;
            break;
        default:
            code = unknow;
            break;
        }
    }
};